feat: experimental two-phase (head-chunked) Ulysses all-to-all#428
Draft
csgoogle wants to merge 1 commit into
Draft
feat: experimental two-phase (head-chunked) Ulysses all-to-all#428csgoogle wants to merge 1 commit into
csgoogle wants to merge 1 commit into
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Add an opt-in ULYSSES_ATTENTION_CHUNKS env var to split the Ulysses all-to-all into per-head-group passes, so XLA's async-collective scheduler can overlap one group's attention compute with the next group's all-to-all. Defaults to 1 (current single-shot path, no behavior change). Numerically identical to single-shot since heads are independent. Notes: - Requires async-collective LIBTPU flags to actually overlap. - Needs heads % (context_shards * chunks) == 0. - Gain is largest when all-to-all is a meaningful fraction of attention time (high context-parallelism / shorter sequences); at WAN 2.2 720p (seq~75600) it is compute-bound so the win is small (~3% in microbench).
7240f50 to
0d936f8
Compare
Perseus14
reviewed
Jun 24, 2026
| # math is identical to the single-shot path (heads are independent); requires | ||
| # async-collective LIBTPU flags to actually overlap, and the per-chunk head | ||
| # count must still be shardable across the context axis. | ||
| num_chunks = int(os.environ.get("ULYSSES_ATTENTION_CHUNKS", "1")) |
Collaborator
There was a problem hiding this comment.
Let's move this to config file to be used for any ulysses type kernel
| f"got heads={num_heads} and context_shards={num_shards}." | ||
| ) | ||
|
|
||
| # EXPERIMENTAL: split the all-to-all into `num_chunks` head-groups so XLA's |
Collaborator
There was a problem hiding this comment.
Does this work on ulysses + ring as well?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add an opt-in ULYSSES_ATTENTION_CHUNKS env var to split the Ulysses all-to-all into per-head-group passes, so XLA's async-collective scheduler can overlap one group's attention compute with the next group's all-to-all. Defaults to 1 (current single-shot path, no behavior change). Numerically identical to single-shot since heads are independent.
Notes: